Fix total_entries inflation in GET /api/v2/importErrors when file has multiple DAGs#67640
Closed
GayathriSrividya wants to merge 4 commits into
Closed
Fix total_entries inflation in GET /api/v2/importErrors when file has multiple DAGs#67640GayathriSrividya wants to merge 4 commits into
GayathriSrividya wants to merge 4 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
Pedrinhonitz
suggested changes
May 28, 2026
c3cefd8 to
34bd56c
Compare
GayathriSrividya
added a commit
to GayathriSrividya/airflow
that referenced
this pull request
Jun 2, 2026
8f9d6e6 to
667792a
Compare
GayathriSrividya
added a commit
to GayathriSrividya/airflow
that referenced
this pull request
Jun 2, 2026
… multiple DAGs When a single import-error file mapped to N DAGs, the previous query JOINed ParseImportError with file_dags_cte producing N rows per error. paginated_select then counted those N rows, inflating total_entries and applying LIMIT/OFFSET against joined rows rather than distinct errors. Fix uses a two-query approach: 1. dedup_stmt with DISTINCT - one row per import error for correct count and pagination via paginated_select 2. import_errors_stmt - full join only for the paginated IDs to gather dag_id associations for authorization/stacktrace redaction Closes apache#67525
667792a to
253261d
Compare
Contributor
Author
|
Closing in favour of #67550, which addresses the same root cause (#67525) and has already received a maintainer approval from @pierrejeambrun and been assigned to the Airflow 3.2.3 milestone. Thanks to @Codingaditya17 for the parallel work — the two-query pagination approach we both converged on was the right call. Drafted-by: GitHub Copilot (Claude Sonnet 4.6); reviewed by @GayathriSrividya before posting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #67525
When a single import-error file mapped to N DAGs, `GET /api/v2/importErrors` returned an inflated `total_entries` (N× the real count) and incorrect pagination behaviour.
Root cause: The query JOINed `ParseImportError` with `file_dags_cte` (one row per DAG per file), producing N rows per import error. `paginated_select` counted those N rows and applied `LIMIT`/`OFFSET` against joined rows rather than distinct import-error objects.
Fix: Two-query approach:
Tests: Added regression test `test_total_entries_counts_distinct_import_errors_when_file_has_multiple_dags` that creates one `ParseImportError` with three associated `DagModel` rows and asserts `total_entries == 1` and the list endpoint returns exactly one entry with `limit=1`.